package com.msb.tank;

import java.awt.*;

public class Explode {
    public static int WIDTH = ResourceMgr.explodes[0].getWidth();
    public static int HEIGHT = ResourceMgr.explodes[0].getHeight();

    private int x, y;

    private  int step = 0;

    public Explode(int x, int y) {
        this.x = x;
        this.y = y;
        new Thread(() -> new Audio("audio/explode.wav").play()).start();
    }

    public void paint(Graphics gs) {
        gs.drawImage(ResourceMgr.explodes[step++], x, x, null);
        if (step >= ResourceMgr.explodes.length) {
            TankFrame.INSTANCE.explodes.remove(this);
        }
    }
}
